<template>
    <!-- 菜单管理 -->
    <div class="pageWrap">
        <h2>基本功能区</h2>
        <el-table :data="entry_list" style="width: 100%">
            <el-table-column label="名称" width="180">
                <template slot-scope="scope">
                    <el-input v-model="scope.row.txt" placeholder="请输入内容"></el-input>
                </template>
            </el-table-column>
            <el-table-column label="地址" width="300">
                <template slot-scope="scope">
                    <el-input v-model="scope.row.path" placeholder="请输入内容"></el-input>
                </template>
            </el-table-column>
            <el-table-column label="是否显示">
                <template slot-scope="scope">
                    <el-radio-group v-model="scope.row.flag">
                        <el-radio :label="1">显示</el-radio>
                        <el-radio :label="2">不显示</el-radio>
                    </el-radio-group>
                </template>
            </el-table-column>
        </el-table>
        <h2 style="margin-top:10px">完赛功能区</h2>
        <el-table :data="end_list" style="width: 100%">
            <el-table-column label="名称" width="180">
                <template slot-scope="scope">
                    <el-input v-model="scope.row.txt" placeholder="请输入内容"></el-input>
                </template>
            </el-table-column>
            <el-table-column label="地址" width="300">
                <template slot-scope="scope">
                    <el-input v-model="scope.row.path" placeholder="请输入内容"></el-input>
                </template>
            </el-table-column>
            <el-table-column label="是否显示">
                <template slot-scope="scope">
                    <el-radio-group v-model="scope.row.flag">
                        <el-radio :label="1">显示</el-radio>
                        <el-radio :label="2">不显示</el-radio>
                    </el-radio-group>
                </template>
            </el-table-column>
        </el-table>
        <el-button type="primary" @click="savemenu()">保存</el-button>
    </div>

</template>

<script>
    export default {
        data() {
            return {
                entry_list: [{
                        id: 1,
                        icon: '/m1.png',
                        txt: '赛事介绍',
                        path: '/pages/AMIntroduce/AMIntroduce',
                        flag: 1
                    },
                    {
                        id: 2,
                        icon: '/m3.png',
                        txt: '报名信息',
                        path: '/mPages/signMsg/signMsg',
                        flag: 1
                    },
                    {
                        id: 3,
                        icon: '/m2.png',
                        txt: '赛道轨迹',
                        path: '/runPages/mMap/mMap',
                        flag: 1
                    },
                    // {
                    //   icon: '/m13.png',
                    //   txt: '赛事天气',
                    //   path: '/mPages/weatherMap/weatherMap'
                    // }, 
                    {
                        id: 4,
                        icon: '/m6.png',
                        txt: '选手竞猜',
                        path: '/guess/gussA/gussA',
                        flag: 1
                    }, {
                        id: 5,
                        icon: '/m4.png',
                        txt: '强制装备',
                        path: '/mPages/fitOut/fitOut',
                        flag: 1
                    }, {
                        id: 6,
                        icon: '/m5.png',
                        txt: '领物信息',
                        path: '/mPages/takeThings/takeThings',
                        flag: 1
                    }, {
                        id: 7,
                        icon: '/m8.png',
                        txt: '酒店信息',
                        path: '/mPages/hotel/hotel',
                        flag: 1
                    }, {
                        id: 8,
                        icon: '/m7.png',
                        txt: '交通信息',
                        path: '/mPages/traffic/traffic',
                        flag: 1
                    }
                ],
                end_list: [{
                    id: 1,
                    icon: '/m9.png',
                    txt: '完赛证书',
                    path: '/mPages/endCer/endCer',
                    flag: 1
                }, {
                    id: 2,
                    icon: '/m10.png',
                    txt: '成绩排行',
                    path: '/mPages/rank/rank',
                    flag: 1
                }, {
                    id: 3,
                    icon: '/m11.png',
                    txt: '赛事相册',
                    path: '/album/albumA/albumA',
                    flag: 1
                }, {
                    id: 4,
                    icon: '/m12.png',
                    txt: '赛事分析',
                    path: '/mPages/report/report',
                    flag: 1
                }]
            };
        },
        methods: {
            savemenu() {
                // console.log(JSON.stringify(this.entry_list), JSON.stringify(this.end_list))
                let config = {
                    entry_list: this.entry_list,
                    end_list: this.end_list
                }
                let p = {
                    matchId: Number(this.$Base64.decode(sessionStorage.getItem("MandA"))),
                    config: JSON.stringify(config)
                }
                this.$axios.post('/sbr/match/putMatchConfig', p).then(res=>{

                })
            },
            getmenu(){
                let matchId= Number(this.$Base64.decode(sessionStorage.getItem("MandA")))
                this.$axios.get('/sbr/match/getMatchConfig?matchId='+matchId).then(res=>{
                    let rr=res.data.data
                    if(rr.config){
                        let c=JSON.parse(rr.config)
                        this.entry_list=c.entry_list
                        this.end_list=c.end_list
                    }
                })
            }
        },
        mounted(){
            this.getmenu()
        }
    }
</script>
<style scoped>
    /* @import url(); 引入公共css类 */
</style>